#include <iostream>
#include <string>
#include "client_socket.h"
#include "client_ControllerSDL.h"
#include <gtkmm-3.0/gtkmm/application.h>
#include "client_Menu.h"
#include "client_Game.h"
#define PORT 4321
#define LARGO 5
using std::string;
using std::cout;
using std::endl;

int main(int argc, char *argv[]) {
    const char* ip = "127.0.0.1";
    Client_socket socket = Client_socket(PORT, (char*) ip);
    if (socket.conectar() == -1) {
        cout << "client_socket.conectar()" << endl;
        return -1;
    }
    try {
        ControllerSDL master;
        Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv,
                "Menu");
        Menu menu(app);
        menu.setSocket(socket);
        menu.run();
    } catch (InitializationException& e) {
        cout << e.what() << endl;
        return 1; //ERROR INICIALIZACION
    }
    socket.cerrar();
    return 0;
}